home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / News / Alexandra.0.82 / Source / ArticleSetMatrix.m < prev    next >
Encoding:
Text File  |  1996-01-30  |  1.3 KB  |  63 lines

  1. #import "ArticleSetMatrix.h"
  2. #import "Article.h"
  3. #import "descriptors.h"
  4. #import <misckit/MiscAppDefaults.h>
  5. #import "MatrixScroller.h"
  6.  
  7. @implementation ArticleSetMatrix
  8.  
  9. - initFrame:(const NXRect *)frameRect
  10. {
  11.    [super initFrame:frameRect];
  12.    [self setCellClass:[Article class]];
  13.    return self;
  14. }
  15.  
  16. - (const char *)stringValueForCellAt:(int)index
  17. {
  18.    int h=[NXApp defaultIntValue:"findGeneralScope"];
  19.    if((h>=0)&&(h<XOVER_COUNT)){
  20.       char *s=[[self cellAt:index :0] header]->fieldBody[h];
  21.       if(s!=NULL)
  22.          return s;
  23.    }
  24.    return "";
  25. }
  26.  
  27. - (void)writeSelectionToPasteboard:(in Pasteboard *)pboard asType:(in NXAtom)type;
  28. {
  29.     id aList=[self getCurrSelections];
  30.  
  31.    if([aList count]==1){
  32.       int h=[NXApp defaultIntValue:"findGeneralScope"];
  33.       if((h>=0)&&(h<XOVER_COUNT)){
  34.          char *s=[[aList objectAt:0] header]->fieldBody[h];
  35.          if(s==NULL)
  36.             return;
  37.          [pboard declareTypes:&type num:1 owner:NULL];
  38.          [pboard writeType:type data:s length:strlen(s)];
  39.       }
  40.    }
  41.    [aList free];
  42.     
  43.    return;
  44. }
  45.  
  46. - (BOOL)selectArticleWithNumber:(long)snumber
  47. {
  48.     int i,j;
  49.     
  50.     [self getNumRows:&j numCols:&i];
  51.     for(i=0;i<j;i++)
  52.         if([[self cellAt:i :0] number]==snumber){
  53.             [self scrollCellToVisible:i upperOffset:1.5 lowerOffset:1.5];
  54.             [self selectCellAt:i :0];
  55.             [self sendAction];
  56.             return TRUE;
  57.         }
  58.         
  59.     return FALSE;
  60. }
  61.  
  62. @end
  63.